home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -websites- / haage&partner / ftp / classx / fm3-demo.lha / FM3-DEMO / Rexx / FM_RXShell.rexx < prev    next >
OS/2 REXX Batch file  |  1997-08-29  |  3KB  |  109 lines

  1. /******************************************************************/
  2. /* ClassX Amiga Rexx script - Copyright © 1997 ClassX Development */
  3. /******************************************************************/
  4.  
  5. /*
  6.     $VER: FM_RXShell.rexx 3.0
  7. */
  8.  
  9. /*
  10. #ITA "Arexx Shell"
  11. #INF "Apre una shell ARexx per utilizzare i comandi di FontMachine"
  12. #INF "- Descrizione:"
  13. #INF "  FontMachine possiede una completa interfaccia AREXX per il controllo"
  14. #INF "  dei vari aspetti del programma. Tramite questa macro, viene aperta"
  15. #INF "  una finestra SHELL con cui pilotare FontMachine a basso livello."
  16. #INF "- Uso:"
  17. #INF "  Dopo aver lanciato la macro, viene aperta una finesta SHELL sullo"
  18. #INF "  schermo di Workbench. Per uscire premere Q+INVIO."
  19. #END
  20. */
  21.  
  22. /*
  23. #ENG "ARexx Shell"
  24. #INF "Opens the ARexx command Shell of FontMachine"
  25. #INF "- Description:"
  26. #INF "  FontMachine provides a complete AREXX interface to enable the"
  27. #INF "  control of the various aspects of the program. This macro opens"
  28. #INF "  a SHELL window where the user can type the FontMachine's low-level"
  29. #INF "  AREXX commands."
  30. #INF "- Usage:"
  31. #INF "  When the macro is started, a SHELL window appears on the Workbench"
  32. #INF "  screen. To stop the macro and close the SHELL type Q + ENTER."
  33. #END
  34. */
  35.  
  36. MYPORT = 'FontMachine'
  37.  
  38. IF ~SHOW('P', MYPORT) THEN DO
  39.     IF EXISTS('FontMachine:FontMachine') THEN DO
  40.         ADDRESS COMMAND 'Run >NIL: FontMachine:FontMachine'
  41.         DO 30 WHILE ~SHOW('P',MYPORT)
  42.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  43.         END
  44.     END
  45.     ELSE DO
  46.         SAY "FontMachine could not be loaded."
  47.         EXIT 10
  48.     END
  49. END
  50.  
  51. IF ~SHOW('P', MYPORT) THEN DO
  52.     SAY 'FontMachine Rexx port could not be opened.'
  53.     EXIT 10
  54. END
  55.  
  56. ADDRESS VALUE MYPORT
  57. OPTIONS RESULTS
  58. OPTIONS FAILAT 10000
  59.  
  60. /******************************************************************/
  61.  
  62. open('console', 'CON:0/11/640/200/FontMachine Rexx Shell/SCREEN "FontMachine [0]"', 'RW')
  63. writeln('console', 'Enter commands, "Q" to exit.')
  64.  
  65. /* loop until user exits */
  66. do forever
  67.  
  68.         /* get command string from user */
  69.         writech('console','CMD> ')
  70.         cmd=readln('console')
  71.  
  72.         select
  73.  
  74.                 /* time to quit? */
  75.                 when (upper(cmd) = "Q") then do
  76.                         leave
  77.                 end
  78.  
  79.                 /* need some help? */
  80.                 when (cmd = "?") then do
  81.                         writeln('console', 'Enter "Q" to exit.')
  82.                 end
  83.  
  84.                 /* do nothing on empty lines */
  85.                 when (cmd = "") then do
  86.                         nop
  87.                 end
  88.  
  89.                 /* whatsinaline */
  90.                 otherwise do
  91.                         /* execute the command string */
  92.                         cmd
  93.  
  94.                         /* if ok show the result, if any */
  95.                         if (RC = 0) then do
  96.                                 if FM_RESULT ~= "" then writeln('console', FM_RESULT)
  97.                         end
  98.  
  99.                         else do
  100.                                 writeln('console', 'Error:' FM_ERROR);
  101.                         end
  102.                 end
  103.         end
  104. end
  105.  
  106. exit(0)
  107.  
  108. /******************************************************************/
  109.